#include <iostream>
#include <algorithm>
using namespace std;
int p1, p2, p3, n;
string s;
string ret;

bool isdig(char ch)
{
    if(ch >= '0' && ch <= '9') return true;
    return false;
}

bool islet(char ch)
{
    if(ch >= 'a' && ch <= 'z') return true;
    return false;
}

void add(char left, char right)
{
    string t;

    // 遍历中间的字符
    for(char ch = left + 1;ch < right;ch++)
    {
        char tmp = ch;
        if(p1 == 2 && islet(tmp)) tmp -= 32;
        if(p1 == 3) tmp = '*';

        for(int j = 0;j < p2;j++)
        {
            t += tmp;
        }
    }

    // 需要逆序
    if(p3 == 2) reverse(t.begin(), t.end());

    ret += t;
}
int main()
{
    cin >> p1 >> p2 >> p3 >> s;
    n = s.size();

    for(int i = 0;i < n;i++)
    {
        char ch = s[i];

        if(ch != '-' || i == 0 || i == n - 1) ret += ch;
        else
        {
            // 判断是否需要展开
            int left = s[i - 1], right = s[i + 1];
            if(isdig(left) && isdig(right) && right > left ||
            islet(left) && islet(right) && right > left)
            {
                // 展开
                add(left, right);
            }
            else ret += ch;
        }
    }

    cout << ret << endl;
    return 0;
}